<template>
  <view class="g_content">
    <view class=" p_10">
      <view class="dis_f_l_c f_s_14 " style="color:#ff9800;">
        <u-icon name="map" size="14" color="#ff9800"></u-icon>
        山东省济宁市任城区
      </view>
      <view class="m_t_10">
        <u-search placeholder="请输入关键字搜索" :clearabled="true" shape="round"></u-search>
      </view>
    </view>
    <uni-card :is-shadow="false">
    <u-grid col="4">
      <u-grid-item v-for="(listItem,listIndex) in typeList" :key="listIndex" @click="handlerType(listIndex)">
        <u-icon :customStyle="{paddingTop:10+'rpx'}" :name="listItem.url" :size="40"></u-icon>
        <text class="m_t_5 f_s_14">{{listItem.configName}}</text>
      </u-grid-item>
    </u-grid>
    </uni-card>
    <view class="bg_f m_t_20">
      <view v-if="list.length>0">
        <s-goods :goodsList="list"></s-goods>
      </view>
      <s-empty v-else></s-empty>
    </view>
    <uni-fab
        :pattern="pattern"
        horizontal="right"
        vertical="bottom"
        direction="horizontal"
        @fabClick="handleToInfo"
    ></uni-fab>
  </view>
</template>
<script>
import { getByKeyApi,getInformationListApi} from "@/sheep/api/index";
import {myMixins} from "@/mixins/myMixins";
export default {
  name: "index",
  mixins:[myMixins],
  data() {
    return {
      typeList:[],
      pattern: {
        color: '#7A7E83',
        backgroundColor: '#fff',
        selectedColor: '#E1BC6D',
        buttonColor: '#E1BC6D',
        iconColor: '#fff'
      },
      list:[]
    }
  },
  onShow() {
    this.getType()
    this.queryObj.pageNum=1
    this.list=[]
    this.getList()
  },
  methods: {
    async getType() {
      let res = await getByKeyApi("goods_type");
      this.typeList = res.data;
    },
    getList(){
      console.log("this.queryObj", this.queryObj);
      this.queryObj.type=1
      getInformationListApi(this.queryObj).then(res=>{
        this.list = this.list.concat(res.rows)
        this.total = res.total
        if (this.queryObj.pageNum*this.queryObj.pageSize<this.total){
          this.status = 'loadmore'
        }else{
          this.status = 'nomore'
        }
        uni.stopPullDownRefresh()
      })
    },
    handlerType(index){},
    handleToInfo(){
      uni.navigateTo({
        url: '/pages/send/info'
      });
    }
  }
}
</script>

<style scoped lang="scss">

</style>
